﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/bug/Bug.master" AutoEventWireup="true" CodeFile="ViewingBug.aspx.cs" Inherits="admin_bug_ViewingBug" %>

<%@ MasterType VirtualPath="~/admin/bug/Bug.master" %>
<%@ Reference VirtualPath="~/admin/Admin.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="SettingHeading" runat="Server">
    View Bugs
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TheForm" runat="Server">
    <div class="a-field" id="viewimg-bug-admin-page">
        <span style="float: left; margin: 7px 0 0 -128px; font-weight: bold;">Project Name</span>
        <div class="a-select">
            <asp:DropDownList ID="ddlProjectName" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlProjectName_SelectedIndexChanged" placeholder="Choose a project">
            </asp:DropDownList>
        </div>
    </div>
    <div id="bug-list-view-admin">
                    <asp:ListView ID="lvView" runat="server" DataSourceID="LinqDataSource1">
                        <EmptyDataTemplate>
                            <p>Relax now, no bugs found!</p>
                        </EmptyDataTemplate>
                        <LayoutTemplate>
                            <div id="ticket_filter_list_header" class="ticket_filter_list_header">
                                <span class="ticket_filter_item_tv_type" style=""></span><span class="ticket_filter_item_tv_customer_name">ID </span><span class="ticket_filter_item_tv_subject">Summary </span><span class="ticket_filter_item_tv_message_count scrollbar_mover">
                                    <img alt="" class="agent_icon_button" src="/images/refresh.png" />
                                </span><span class="ticket_filter_item_tv_status scrollbar_mover">Status </span><span class="ticket_filter_item_tv_priority scrollbar_mover">
                                    <img alt="" class="agent_icon_button" src="/images/label.png" style="margin-left: 2px;" />
                                </span><span class="ticket_filter_item_tv_updated scrollbar_mover">Updated </span><span class="ticket_filter_item_tv_assigned scrollbar_mover">Version </span><span class="ticket_filter_item_tv_actions scrollbar_mover">Actions </span>
                            </div>
                            <div id="ticket_filter_list_items_outer_div" class="ticket_filter_list_items table_view">
                                <div id="ticket_filter_list_items_data_div">
                                    <div id="ticket_filter_list_items">
                                        <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
                                    </div>
                                    <div id="ticket_filter_item_paginator">
                                        Page
                                        <asp:DataPager ID="DataPager" PageSize="10" runat="server">
                                            <Fields>
                                                <asp:NumericPagerField ButtonCount="10" PreviousPageText="«" NextPageText="»" />
                                            </Fields>
                                        </asp:DataPager>
                                    </div>
                                </div>
                            </div>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <!-- first item, selected -->
                            <div class="ticket_filter_item ticket_filter_item_table_view">
                                <!-- bug type image -->
                                <span class="ticket_filter_item_tv_type">
                                    <img alt="" title="<%# EnumUtility.GetEnumNiceName((BugManagement.Type)Eval("Type")) %>" class="agent_icon_button vtip" src="/images/bug/type/<%# Eval("Type") %>.png" />
                                </span>
                                <!-- bug ID -->
                                <div class="ticket_filter_item_tv_customer_name">
                                    <a href="/Bug.aspx?id=<%# Eval("BugId") %>" title="Click to view bug details">
                                        <%# Eval("BugId") %>
                                    </a>
                                </div>
                                <!-- bug severity -->
                                <div class="ticket_filter_item_tv_subject">
                                    <div class="ticket_filter_item_data ticket_filter_item_tv_labels">
                                        <ul class="token-input-list-facebook bug-severity">
                                            <li class="token-input-token-facebook bug-severity-<%# EnumUtility.GetEnumNiceName((BugManagement.Severity)Eval("Severity")) %>">
                                                <p title="Severity level of this bug">
                                                    <%# EnumUtility.GetEnumNiceName((BugManagement.Severity)Eval("Severity")) %>
                                                </p>
                                            </li>
                                        </ul>
                                    </div>
                                    <!-- bug summary -->
                                    <a href="#" class="vtip" title="<%# Eval("Description") %>">
                                        <%# Eval("Summary").ToString().Length < 100 ? Eval("Summary") : Eval("Summary").ToString().Substring(0, 99) %>
                                    </a>
                                </div>
                                <!-- comment count -->
                                <span class="lesser_data ticket_filter_item_tv_message_count">
                                    <img alt="" title="Reproducability: <%# EnumUtility.GetEnumNiceName((BugManagement.Reproducability)Eval("Reproducability")) %>" class="agent_icon_button vtip" src="/images/bug/repro/<%# Eval("Reproducability") %>.png" />
                                </span>
                                <!-- status -->
                                <span class="lesser_data ticket_filter_item_tv_status" style="margin-top: 1px"><span class="ticket_filter_item_status_box bug_status_<%# EnumUtility.GetEnumNiceName((BugManagement.ShortStatus)Eval("Status"))%>"><span class="ticket_filter_item_data">
                                    <%# EnumUtility.GetEnumNiceName((BugManagement.ShortStatus)Eval("Status")) %>
                                </span></span></span>
                                <!-- priority -->
                                <span class="lesser_data ticket_filter_item_tv_priority"><span style="float: right; margin-top: 0;">
                                    <img alt="" title="Priority: <%# EnumUtility.GetEnumNiceName((BugManagement.Priority)Eval("Priority")) %>" class="agent_icon_button vtip" src="/images/bug/priority/<%# Eval("Priority") %>.png" style="margin-top: -3px; margin-right: 0pt;" height="16" width="16" />
                                </span></span>
                                <!-- last updated -->
                                <span class="lesser_data ticket_filter_item_time ticket_filter_item_tv_updated">
                                    <%# (DateTime.Now - (DateTime)(Eval("LastUpdatedDate"))).TotalHours > 24 ? ((DateTime.Now - (DateTime)(Eval("LastUpdatedDate"))).Days == 1 ? "1 day ago" : (DateTime.Now - (DateTime)(Eval("LastUpdatedDate"))).Days.ToString() + " days ago") : ((DateTime.Now - (DateTime)(Eval("LastUpdatedDate"))).Hours == 1 ? "1 hour ago" : (DateTime.Now - (DateTime)(Eval("LastUpdatedDate"))).Hours.ToString() + " hours ago") %>
                                </span>
                                <!-- version -->
                                <span class="lesser_data ticket_filter_item_tv_assigned">
                                    <%# Eval("BugFoundInVersion")%>
                                </span>
                                <!-- actions -->
                                <span class="ticket_filter_item_tv_actions" style="margin-top: 2px;"><a title="Open In New Window" class="ticket_filter_item_tv_tip_open ticket_filter_action_open" href="/Bug.aspx?id=<%# Eval("BugId") %>" target="_blank">
                                    <img alt="" class="agent_icon_button bug-lightbox" src="/images/open.png" height="16" width="16" /></a> <a title="Quick View" class="ticket_filter_item_tv_tip_view" href="/BugLite.aspx?id=<%# Eval("BugId") %>">
                                        <img alt="" class="agent_icon_button" src="/images/view.png" height="16" width="16" /></a> <a title="Resolve" class="ticket_filter_item_tv_tip_resolve" href="/BugCheck.aspx?id=<%# Eval("BugId") %>">
                                            <img alt="" class="agent_icon_button" src="/images/quick_resolve.png" height="16" width="16" /></a> </span>
                            </div>
                        </ItemTemplate>
                    </asp:ListView>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="KillDaBugsDataContext" EntityTypeName="" Select="new (Type, BugId, Severity, Summary, Status, Reproducability, Priority, LastUpdatedDate, BugFoundInVersion, Description)" TableName="Bugs" OrderBy="LastUpdatedDate desc" Where="ProjectId == @ProjectId">
            <WhereParameters>
                <asp:ControlParameter ControlID="ddlProjectName" Name="ProjectId" PropertyName="SelectedValue" Type="Int32" />
            </WhereParameters>
        </asp:LinqDataSource>
    </div>
</asp:Content>